
#include "config.hpp"

#include "atr/core/if.hpp"

using namespace atr::core;

TEST(Core_IfTest, SimpleTrue)
{
	using T = _if<_true>::_<int>
				::_else::_<char>
				::type;

	EXPECT_SAME ( int, T );
}

TEST(Core_IfTest, SimpleFalse)
{
	using T = _if<_false>::_<int>
				::_else::_<char>
				::type;

	EXPECT_SAME ( char, T );
}

TEST(Core_IfTest, If_True_ElseIf_False)
{
	using T = _if<_true>::_<int>
				::_else_if<_false>::_<char>
				::_else::_<long>
				::type;

	EXPECT_SAME ( int, T );
}

TEST(Core_IfTest, If_False_ElseIf_True)
{
	using T = _if<_false>::_<int>
				::_else_if<_true>::_<char>
				::_else::_<long>
				::type;

	EXPECT_SAME ( char, T );
}

TEST(Core_IfTest, If_False_ElseIf_False)
{
	using T = _if<_false>::_<int>
				::_else_if<_false>::_<char>
				::_else::_<long>
				::type;

	EXPECT_SAME ( long, T );
}

TEST(Core_IfTest, If_True_ElseIf_True)
{
	using T = _if<_true>::_<int>
				::_else_if<_true>::_<char>
				::_else::_<long>
				::type;

	EXPECT_SAME ( int, T );
}

TEST(Core_IfTest, If_True_ElseIf_False_ElseIf_False)
{
	using T = _if<_true>::_<int>
				::_else_if<_false>::_<char>
				::_else_if<_false>::_<long>
				::_else::_<short>
				::type;

	EXPECT_SAME ( int, T );
}

TEST(Core_IfTest, If_False_ElseIf_True_ElseIf_False)
{
	using T = _if<_false>::_<int>
				::_else_if<_true>::_<char>
				::_else_if<_false>::_<long>
				::_else::_<short>
				::type;

	EXPECT_SAME ( char, T );
}

TEST(Core_IfTest, If_False_ElseIf_False_ElseIf_True)
{
	using T = _if<_false>::_<int>
				::_else_if<_false>::_<char>
				::_else_if<_true>::_<long>
				::_else::_<short>
				::type;

	EXPECT_SAME ( long, T );
}

TEST(Core_IfTest, If_False_ElseIf_False_ElseIf_False)
{
	using T = _if<_false>::_<int>
				::_else_if<_false>::_<char>
				::_else_if<_false>::_<long>
				::_else::_<short>
				::type;

	EXPECT_SAME ( short, T );
}

TEST(Core_IfTest, If_True_ElseIf_False_ElseIf_True)
{
	using T = _if<_true>::_<int>
				::_else_if<_false>::_<char>
				::_else_if<_true>::_<long>
				::_else::_<short>
				::type;

	EXPECT_SAME ( int, T );
}

TEST(Core_IfTest, If_True_ElseIf_True_ElseIf_True)
{
	using T = _if<_true>::_<int>
				::_else_if<_true>::_<char>
				::_else_if<_true>::_<long>
				::_else::_<short>
				::type;

	EXPECT_SAME ( int, T );
}

TEST(Core_IfTest, If_True_ElseIf_True_ElseIf_False)
{
	using T = _if<_true>::_<int>
				::_else_if<_true>::_<char>
				::_else_if<_false>::_<long>
				::_else::_<short>
				::type;

	EXPECT_SAME ( int, T );
}

TEST(Core_IfTest, If_False_ElseIf_True_ElseIf_True)
{
	using T = _if<_false>::_<int>
				::_else_if<_true>::_<char>
				::_else_if<_true>::_<long>
				::_else::_<short>
				::type;

	EXPECT_SAME ( char, T );
}
